package com.business.user.validator;
import com.jfinal.core.Controller;
import com.jfinal.validate.Validator;
public class UserValidator extends Validator {
	//用于判断session中是否存在user对象
	@Override
	protected void validate(Controller c) {
		if(c.getSession().getAttribute("user")==null){
			addError("errorMessage", "noLogin");
		}
	}

	// 验证validate内容出现错误则执行handleError
	@Override
	protected void handleError(Controller c) {
		c.forwardAction("/");
	}

}